//
//  MainTabBar.m
//  ErmaoDJ
//
//  Created by NextStep on 2017/12/26.
//  Copyright © 2017年 NextStep. All rights reserved.
//

#import "MainTabBar.h"
#import "UIView+Extension.h"
@implementation MainTabBar

//布局子控件
-(void)layoutSubviews {
    [super layoutSubviews];
    
    //取出子控件个数
    NSInteger count = self.subviews.count;
    //计算每个button的宽度
    CGFloat buttonWidth = self.width / 4;
    
    NSInteger index = 0;
    for (int i =0; i<count; i++) {
        UIView *childView = self.subviews[i];
        if ([childView isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
            //设置宽度与x值
            childView.width = buttonWidth;
            //设置x
            childView.X = buttonWidth *index;
            index ++;
        }
    }
    
}

@end
